package com.example.agrigreennewssys.dao;

import com.example.agrigreennewssys.entity.Comment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 光的代言人
 */
@Mapper
public interface CommentMapper {
    int insert(Comment comment);

    List<Comment> selectByArticleId(@Param("articleId") Long articleId);

    List<Comment> selectAllComments();

    List<Comment> selectRepliesByParentId(@Param("parentId") Long parentId);

    int incrementLikes(@Param("commentId") Long commentId);

    int decrementLikes(@Param("commentId") Long commentId);

    Comment selectById(@Param("id") Long id);

    int deleteById(@Param("id") Long id);

    // 更改评论状态
    int updateStatus(@Param("id") Long id, @Param("status") Integer status);
}
